﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="QL_Dethi.aspx.cs" Inherits="DOAN.Admin.QL_Dethi" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type = "text/javascript">
function checkAll(objRef)
{
    var GridView = objRef.parentNode.parentNode.parentNode;
    var inputList = GridView.getElementsByTagName("input");
    for (var i=0;i<inputList.length;i++)
    {
        //Get the Cell To find out ColumnIndex
        var row = inputList[i].parentNode.parentNode;
        if(inputList[i].type == "checkbox"  && objRef != inputList[i])
        {
            if (objRef.checked)
            {
                //If the header checkbox is checked
                //check all checkboxes
                //and highlight all rows
                row.style.backgroundColor = "aqua";
                inputList[i].checked=true;
            }
            else
            {
                //If the header checkbox is checked
                //uncheck all checkboxes
                //and change rowcolor back to original 
                if(row.rowIndex % 2 == 0)
                {
                   //Alternating Row Color
                   row.style.backgroundColor = "#C2D69B";
                }
                else
                {
                   row.style.backgroundColor = "white";
                }
                inputList[i].checked=false;
            }
        }
    }
}
</script>  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="content-right">
    <asp:Label Text="Môn học" runat="server"></asp:Label>
    <asp:DropDownList ID="drpMon" runat="server">
    </asp:DropDownList>
    <br />
    <asp:RadioButton ID="rdTD" GroupName="ck" runat="server" Text="Tự động"
        AutoPostBack="True" oncheckedchanged="rdTD_CheckedChanged" />
    <asp:RadioButton ID="rdTC" GroupName="ck" runat="server" Text="Thủ công" 
        AutoPostBack="True" oncheckedchanged="rdTC_CheckedChanged" />
    <br />
    <asp:Panel ID="pnTaoDeTD" runat="server" Visible="false">
        <asp:RadioButton ID="rdDokho" GroupName="td" runat="server" Text="Theo độ khó"
        AutoPostBack="True" oncheckedchanged="rdDokho_CheckedChanged" />
    <asp:RadioButton ID="RadioButton2" GroupName="td" runat="server" Text="Theo chương" 
        AutoPostBack="True" oncheckedchanged="rdChuong_CheckedChanged" />
    <br />
    
    
    
    <asp:Panel ID="pnDokho" runat="server" Visible="false">
        <asp:Label ID="Label3" Text="Tổng số câu" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtTong" Width="130px"></asp:TextBox>
        <asp:Label Text="Tổng số câu phải chia hết cho 10" runat="server"></asp:Label><br />
        <asp:Label Text="Số câu khó" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtKho" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label1" Text="Số câu trung bình" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtTB" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label2" Text="Số câu dễ" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtDe" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label4" Text="Trạng thái" runat="server" Width="130px"></asp:Label>
                                    <asp:DropDownList ID="drTT"  Width="128px" runat="server">
                                        <asp:ListItem Selected="True" Value="1">Mở</asp:ListItem>
                                        <asp:ListItem Value="0">Đóng</asp:ListItem>
                                      
                                    </asp:DropDownList>
                              <br />
                              
        <asp:Button ID="btTao" runat="server" Text="Tạo đề" OnClick="btTao_Click" />
        </asp:Panel>
        
        
        
        
    </asp:Panel>
    
    <asp:Panel ID="pnChuong" runat="server" Visible="false">
        <asp:Label ID="Label16" Text="Tổng số câu" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txttong2" Width="130px"></asp:TextBox>
        <asp:Label ID="Label17" Text="Tổng số câu phải chia hết cho 10" runat="server"></asp:Label><br />
        <asp:Label ID="Label5" Text="Số câu chương 1" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong1" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label6" Text="Số câu chương 2" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong2" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label7" Text="Số câu chương 3" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong3" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label8" Text="Số câu chương 4" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong4" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label9" Text="Số câu chương 5" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong5" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label11" Text="Số câu chương 6" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong6" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label12" Text="Số câu chương 7" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong7" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label13" Text="Số câu chương 8" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong8" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label14" Text="Số câu chương 9" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong9" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label15" Text="Số câu chương 10" runat="server" Width="130px"></asp:Label>
        <asp:TextBox Text="0" runat="server" ID="txtChuong10" Width="130px"></asp:TextBox><br />
        <asp:Label ID="Label10" Text="Trạng thái" runat="server" Width="130px"></asp:Label>
                                    <asp:DropDownList ID="DropDownList1"  Width="128px" runat="server">
                                        <asp:ListItem Selected="True" Value="1">Mở</asp:ListItem>
                                        <asp:ListItem Value="0">Đóng</asp:ListItem>
                                      
                                    </asp:DropDownList>
                              <br />
                              
        <asp:Button ID="Button1" runat="server" Text="Tạo đề" onclick="btTao2_Click"/>
        </asp:Panel>
        
        
        
        
    <br />
    <asp:Panel ID="GridDe" Visible="false" runat="server">
        <asp:GridView runat="server" ID="GridDethi" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
            AllowPaging="True"  OnPageIndexChanging="gridCauhoi_PageIndexChanging" CellPadding="4" GridLines="None" Width="679px" 
            ForeColor="#333333" onrowdatabound="GridDethi_RowDataBound">
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <Columns>
                <asp:TemplateField HeaderText="Chọn" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:CheckBox ID="ckb" runat="server" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã câu hỏi:" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblMaCH" Text='<%#DataBinder.Eval(Container.DataItem,"Macauhoi") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Nội dung" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuong2" Text='<%#DataBinder.Eval(Container.DataItem,"Noidung") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Độ khó" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon2g" Text='<%#DataBinder.Eval(Container.DataItem,"Dokho") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Chương" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon2gg" Text='<%#DataBinder.Eval(Container.DataItem,"Chuong") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:Button ID="btLuu" Text="Lưu" runat="server" OnClick="btLuu_Click" Visible="False" />
        </asp:Panel>
        
        
        <br />
        <asp:Panel ID="GridDe2" Visible="false" runat="server">
        <asp:GridView runat="server" ID="GridDethi2" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
            AllowPaging="True"  OnPageIndexChanging="gridCauhoi2_PageIndexChanging" DataKeyNames="Macauhoi"
                CellPadding="4" GridLines="None" Width="679px" 
            ForeColor="#333333" onrowdatabound="GridDethi2_RowDataBound" >
              <%--  onprerender="GridDethi2_PreRender">--%>
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <Columns>
                <asp:TemplateField HeaderText="Chọn" HeaderStyle-HorizontalAlign="Left">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkAll" runat="server" onclick = "checkAll(this);" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="ckb2" runat="server" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã câu hỏi:" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblMaCH2" Text='<%#DataBinder.Eval(Container.DataItem,"Macauhoi") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Nội dung" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuong3" Text='<%#DataBinder.Eval(Container.DataItem,"Noidung") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Độ khó" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon3g" Text='<%#DataBinder.Eval(Container.DataItem,"Dokho") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Chương" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon3gg" Text='<%#DataBinder.Eval(Container.DataItem,"Chuong") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView><br />
        <asp:Label ID="lbSumrecord" runat="server"></asp:Label><br />
        <asp:Button ID="Button2" Text="Lưu" runat="server" Visible="False" 
            onclick="btLuu2_Click" />
            </asp:Panel>
            
            <br />
             <asp:Panel ID="GridDe3" Visible="false" runat="server">
        <asp:GridView runat="server" ID="GridDethi3" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
            AllowPaging="True"  OnPageIndexChanging="gridCauhoi3_PageIndexChanging" CellPadding="4" GridLines="None" Width="679px" 
            ForeColor="#333333" onrowdatabound="GridDethi3_RowDataBound">
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <Columns>
                <asp:TemplateField HeaderText="Chọn" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:CheckBox ID="ckb3" runat="server" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã câu hỏi:" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblMaCH3" Text='<%#DataBinder.Eval(Container.DataItem,"Macauhoi") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Nội dung" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuong4" Text='<%#DataBinder.Eval(Container.DataItem,"Noidung") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Độ khó" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon4g" Text='<%#DataBinder.Eval(Container.DataItem,"Dokho") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Chương" HeaderStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSochuon4gg" Text='<%#DataBinder.Eval(Container.DataItem,"Chuong") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
            <asp:Button ID="Button3" Text="Lưu" runat="server" Visible="False" 
            onclick="btLuu3_Click" />
    </asp:Panel>
    </div>
</asp:Content>
